function getMonthDay(today) {
    if (today == undefined) {
        today = new Date();
    }
    // 获取当月第一天
    var firstDay = new Date(today.getFullYear(), today.getMonth(), 1);
    // 获取当月最后一天
    var lastDay = new Date(today.getFullYear(), today.getMonth() + 1, 0);
    // 定义一个数组存储所有日期
    var dates = [];
    // 循环从第一天到最后一天，将每一天的日期添加到数组中
    for (var i = firstDay.getDate(); i <= lastDay.getDate(); i++) {
        var currentDate = new Date(today.getFullYear(), today.getMonth(), i);
        dates.push([getDayToWeek(currentDate), currentDate.getDate()]);
    }
    return dates;
}


function getDayToWeek(date) {
    const days = ['日', '一', '二', '三', '四', '五', '六'];
    return days[date.getDay()];
}

function loadScript(url) {
    var script = document.createElement('script');
    script.src = url + "?t=" + new Date().getTime();
    script.async = true; // 可选，根据需要设置
    document.body.appendChild(script);
}

function openTaskData(table, pid) {
    table.render({
        elem: '#taskTable'
        , url: '/project/getUserTaskInfo?pid=' + pid
        , method: 'get'
        , cellMinWidth: 50
        , page: false
        , limit: 50
        , height: 'full-65'
        , loading: true
        , size: 'sm'
        , cols: [
            [ //标题栏
                {field: 'taskName', title: '任务名称'},
            ]
        ],
        done: function (res, curr, count) {
            fillingModel = res.data.fillingModel;
            $('.layui-table-view[lay-table-id="taskTable"]').children(".layui-table-box").children(".layui-table-body").find('table tbody tr[data-index="0"]').click();
        },
    });
}
